import { request } from '@inbiz/utils';
// 新增同义词
export async function CreateSynonymWord(params: any) {
  return request('/search/IndexSynonym/CreateSynonymWord', {
    method: 'POST',
    requestType: 'form',
    data: {
      KeyWord:params.KeyWord,
    },
    headers: {
      'Content-Type': 'application/x-www-form-urlencoded;',
    },
  });
}

// 更新同义词
export async function UpdateSynonymWord(params: any) {
  return request('/search/IndexSynonym/UpdateSynonymWord', {
    method: 'POST',
    requestType: 'form',
    data: {
      KeyWord: params.KeyWord,
      Id: params.Id,
    },
    headers: {
      'Content-Type': 'application/x-www-form-urlencoded;',
    },
  });
}

// 获取同义词列表
export async function GetSynonymWord(params:any){
  return request('/search/IndexSynonym/GetSynonymWord', {
    method: 'POST',
    requestType: 'form',
    data: {
      KeyWord: params.KeyWord,
      PageIndex: params.PageIndex,
      PageSize: params.PageSize,
    },
    headers: {
      'Content-Type': 'application/x-www-form-urlencoded;',
    },
  });
}

// 删除同义词
export async function DeleteSynonymWord(params: any) {
  return request('/search/IndexSynonym/DeleteSynonymWord', {
    method: 'POST',
    requestType: 'form',
    data: {
      ids: params.Id,
    },
    headers: {
      'Content-Type': 'application/x-www-form-urlencoded;',
    },
  });
}

// 新增扩展词
export async function CreateExtendWord(params: any) {
  return request('/search/IndexExtent/CreateExtendWord', {
    method: 'POST',
    requestType: 'form',
    data: {
      KeyWord:params.KeyWord,
    },
    headers: {
      'Content-Type': 'application/x-www-form-urlencoded;',
    },
  });
}

// 获取扩展词列表
export async function GetExtendWord(params: any) {
  return request('/search/IndexExtent/GetExtendWord', {
    method: 'POST',
    requestType: 'form',
    data: {
      KeyWord: params.KeyWord,
      PageIndex: params.PageIndex,
      PageSize: params.PageSize,
    },
    headers: {
      'Content-Type': 'application/x-www-form-urlencoded;',
    },
  });
}

// 更新扩展词
export async function UpdateExtendWord(params: any) {
  return request('/search/IndexExtent/UpdateExtendWord', {
    method: 'POST',
    requestType: 'form',
    data: {
      KeyWord: params.KeyWord,
      Id: params.Id,
    },
    headers: {
      'Content-Type': 'application/x-www-form-urlencoded;',
    },
  });
}

// 删除扩展词
export async function DeleteExtendWord(params: any) {
  return request('/search/IndexExtent/DeleteExtendWord', {
    method: 'POST',
    requestType: 'form',
    data: {
      ids: params.Id,
    },
    headers: {
      'Content-Type': 'application/x-www-form-urlencoded;',
    },
  });
}


// 获取停用词列表
export async function GetDisableWord(params?: any) {
  return request('/search/IndexDisable/GetDisableWord', {
    method: 'POST',
    requestType: 'form',
    data: {
      KeyWord: params.KeyWord,
      PageIndex: params.PageIndex,
      PageSize: params.PageSize,
    },
    headers: {
      'Content-Type': 'application/x-www-form-urlencoded;',
    },
  });
}
// 新增停用词
export async function CreateDisableWord(params?: any) {
  return request('/search/IndexDisable/CreateDisableWord', {
    method: 'POST',
    requestType: 'form',
    data: {
      KeyWord: params.KeyWord,
    },
    headers: {
      'Content-Type': 'application/x-www-form-urlencoded;',
    },
  });
}

// 更新停用词
export async function UpdateDisableWord(params?: any) {
  return request('/search/IndexDisable/UpdateDisableWord', {
    method: 'POST',
    requestType: 'form',
    data: {
      KeyWord: params.KeyWord,
      Id: params.Id,
    },
    headers: {
      'Content-Type': 'application/x-www-form-urlencoded;',
    },
  });
}

// 删除停用词
export async function DeleteDisableWord(params: any) {
  return request('/search/IndexDisable/DeleteDisableWord', {
    method: 'POST',
    requestType: 'form',
    data: {
      ids: params.Id,
    },
    headers: {
      'Content-Type': 'application/x-www-form-urlencoded;',
    },
  });
}



// 获取正则分词器
export async function GetTokenizerAsync(params?: any) {
  return request('/search/IndexTokenizer/GetTokenizerAsync', {
    method: 'POST',
    requestType: 'form',
    data: {
      KeyWord: params.KeyWord,
      PageIndex: params.PageIndex,
      PageSize: params.PageSize,
    },
    headers: {
      'Content-Type': 'application/x-www-form-urlencoded;',
    },
  });
}

// 创建正则分词器
export async function CreateTokenizer(params?: any) {
  return request('/search/IndexTokenizer/CreateTokenizer', {
    method: 'POST',
    requestType: 'form',
    data: {
      TokenizerName: params.TokenizerName,
      TokenizerRule: params.TokenizerRule,
      TokenizerDesc: params.TokenizerDesc,
    },
    headers: {
      'Content-Type': 'application/x-www-form-urlencoded;',
    },
  });
}

// 判断分词器是否使用
export async function ExistsTokeninerByName(params?: any) {
  return request('/search/IndexTokenizer/ExistsTokeninerByName', {
    method: 'POST',
    requestType: 'form',
    data: {
      TokenizerName: params,
    },
    headers: {
      'Content-Type': 'application/x-www-form-urlencoded;',
    },
  });
}

// 修改正则分词器
export async function UpdateTokenizer(params?: any) {
  return request('/search/IndexTokenizer/UpdateTokenizer', {
    method: 'POST',
    requestType: 'form',
    data: {
      TokenizerName: params.TokenizerName,
      TokenizerRule: params.TokenizerRule,
      TokenizerDesc: params.TokenizerDesc,
      Id: params.Id,
    },
    headers: {
      'Content-Type': 'application/x-www-form-urlencoded;',
    },
  });
}

// 删除正则分词器
export async function DeleteTokenizerById(params?: any) {
  return request('/search/IndexTokenizer/DeleteTokenizerById', {
    method: 'POST',
    requestType: 'form',
    data: {
      ids: params.Id,
    },
    headers: {
      'Content-Type': 'application/x-www-form-urlencoded;',
    },
  });
}

// 正则分词验证
export async function GetAnalyzerByText(params?: any) {
  return request('/search/IndexTokenizer/GetAnalyzerByText', {
    method: 'POST',
    requestType: 'form',
    data: {
      analyzer: params.TokenizerRule,
      text:params.text
    },
    headers: {
      'Content-Type': 'application/x-www-form-urlencoded;',
    },
  });
}
